package training;

import java.util.Scanner;

/**
 * @Author liangzai
 * @Description:
 */
public class J25_6_26_Training {
    //亚运奖牌榜
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[][] nums = new int[2][3];
        for(int i = 0; i < n; i++){
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            nums[a][b-1]++;
        }
        System.out.println(nums[0][0]+" "+nums[0][1]+" "+nums[0][2]);
        System.out.println(nums[1][0]+" "+nums[1][1]+" "+nums[1][2]);
        if(nums[0][0]!=nums[1][0]){
            if(nums[0][0]>nums[1][0]){
                System.out.println("The first win!");
            }else{
                System.out.println("The second win!");
            }
            //return;
        }else if((nums[0][1]!=nums[1][1])){
            if(nums[0][1]>nums[1][1]){
                System.out.println("The first win!");
            }else{
                System.out.println("The second win!");
            }
            //return;
        }else{
            if(nums[0][2]>nums[1][2]){
                System.out.println("The first win!");
            }else{
                System.out.println("The second win!");
            }
            //return;
        }
    }
}
